/**
 * Displays a panel for selecting a single unit from a stacked pile
 */
SelectUnitDialog = new Class({
	
	initialize : function(units){
		$(document.body).adopt(createLightboxShade());
		var root = new ControlNode({
			parentNode : null,
			isActive : true,
			visible : true,
		});
		for(var n=0;n<units.length;n++){
			var child = new ControlNode({
				title : '#'+units[n].getId(),
				parentNode : root,
				visible : true,
				
			});
			root.addChild(child);
			if(n%2){
				child.element.setStyle('top','0px');
				child.element.setStyle('left','-'+((n)*50)+'px');
			}else{
				child.element.setStyle('top','0px');
				child.element.setStyle('left',((n+1)*50)+'px');
			}
		}
		root.render();
	},
	
});